
#ifndef PLAYER_H
#define PLAYER_H

#include <OGRE/Ogre.h>
#include <OgreMatrix3.h>
#include <OgreMath.h>

#include "MovableGameObject.h"

/**
 * @brief The Player class.
 *
 * A Player class is responsible to initialise, setup and destroy the player in the game
 */
class Player : public MovableGameObject
{
public:
    /** Constructor of Player
     *
     * @param p_OgreSceneManager: Scene Manager
     * @param p_ResourceGroupName: Name of current resource group
     */
    Player(Ogre::String p_Name, Ogre::SceneManager* p_SceneManager, Ogre::String p_ResourceGroupName);

    /** Destructor of Player
     *
     * @brief destroyes player entity, nodes and physics
     */
    ~Player();


    /**
    * @brief gets camera
    *
    * @return Camera to be attached at the players position
    */
	Ogre::Camera* GetCamera();

    /**
    * @brief Gets position
    *
    * @return 3d position of Object root node
    */
	const Ogre::Vector3& GetPosition() { return m_ObjectRootNode->getPosition(); }

    /**
    * @brief Gets score
    *
    * @return score
    */
    unsigned int GetScore() { return m_Score; }

	void Update();

	void InvokeUp();
	void InvokeDown();
	void InvokeLeft();
	void InvokeRight();

private:
	void Move();
	void SetPosition(const Ogre::Vector3& p_Postition) { m_ObjectRootNode->setPosition(p_Postition); }

    void CreateEntity();
	void CreateNodes();
	void CreateEntityNode();
	void CreateCameraNode();
	void CreateLightNode();
    void CreateSpotLightNode();

	unsigned int m_Score;
	Ogre::Real m_Difficulty;

    Ogre::Entity *m_EntityTail;

    Ogre::Vector3 m_Velocity;

	Ogre::String m_Name;
	Ogre::SceneManager *m_SceneManager;

	Ogre::Light* m_Light;
    Ogre::Light* m_SpotLight;
	Ogre::Camera* m_Camera;

	Ogre::Degree m_dPhi;
	Ogre::Degree m_dPhiY;
	Ogre::Degree m_dPhiZ;

	Ogre::SceneNode *m_CameraNode;
    Ogre::SceneNode *m_LightNode;
    Ogre::SceneNode *m_SpotLightNode;

    Ogre::String m_ResourceGroupName;

};

#endif // PLAYER_H
